4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 * http://www.gnu.org/copyleft/gpl.html
21 * A querypage to list the most wanted categories - implements Special:Wantedcategories
24 * @ingroup SpecialPage
26 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
27 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
28 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
30 class WantedCategoriesPage
extends WantedQueryPage
{
33 return 'Wantedcategories';
37 $dbr = wfGetDB( DB_SLAVE
);
38 list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
39 $name = $dbr->addQuotes( $this->getName() );
44 " . NS_CATEGORY
. " as namespace,
48 LEFT JOIN $page ON cl_to = page_title AND page_namespace = ". NS_CATEGORY
."
49 WHERE page_title IS NULL
54 function formatResult( $skin, $result ) {
55 global $wgLang, $wgContLang;
57 $nt = Title
::makeTitle( $result->namespace, $result->title
);
58 $text = htmlspecialchars( $wgContLang->convert( $nt->getText() ) );
60 $plink = $this->isCached() ?
61 $skin->link( $nt, $text ) :
70 $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
71 $wgLang->formatNum( $result->value
) );
72 return wfSpecialList($plink, $nlinks);
79 function wfSpecialWantedCategories() {
80 list( $limit, $offset ) = wfCheckLimits();
82 $wpp = new WantedCategoriesPage();
84 $wpp->doQuery( $offset, $limit );